package com.example.kotlinstudy.bean;

public class Test {
    public static void main(String[] args) {


        //匿名函数
        showPersonInfo("fnaxixi", "33", new IShowResult() {
            @Override
            public void result(String result) {
                System.out.println(result);

            }
        });

        //具名函数
        IShowResult showResult =new showResultImpl();
        showPersonInfo("fnaxixi", "33", showResult);

    }

    public static class  showResultImpl implements  IShowResult{

        @Override
        public void result(String result) {
            System.out.println(result);
        }
    }

    public interface IShowResult{
        void result(String result);
    }

   public static void showPersonInfo(String name, String age, IShowResult showResult) {
        String str = "我是"+name+",今年"+age +"岁了";
        showResult.result(str);
    }
}
